import java.sql.*;
public class Select {
    public static void main(String args[]){
        Connection con;
        Statement st;
        ResultSet rs;
        String dbURL="jdbc:sqlserver://localhost:1433;DatabaseName=BlogSystemLD";
        String userName="sa";
        String userPwd="123";
        String sql="select * from User_View";
        try {
            con = DriverManager.getConnection(dbURL, userName, userPwd);
            st = con.createStatement();
            rs = st.executeQuery(sql);
            while (rs.next()) {
                String user_id = rs.getString(1);
                String user_grade = rs.getString(2);
                String number = rs.getString(3);
                String times = rs.getString(4);
                String integral = rs.getString(5);
                int num=Integer.parseInt(integral);
                System.out.println("用户ID：" + user_id + "\n用户等级：" + user_grade + "\n博客数量：" + number
                        + "\n评论次数：" + times  + "\n总积分：" + num );
                System.out.println("\n");
            }
            rs.close();
            st.close();
            con.close();
        }catch(SQLException e){
            e.printStackTrace();
            System.out.println("数据库连接失败！！！");
        }

    }
}